<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <!-- import Vue.js -->
    <script src="//vuejs.org/js/vue.min.js"></script>
    <!-- import stylesheet -->
    <link rel="stylesheet" href="//unpkg.com/view-design/dist/styles/iview.css">
    <!-- import iView -->
    <script src="//unpkg.com/view-design/dist/iview.min.js"></script>
</head>
<body>
<div id="app">
    <p>{{ message }}</p>
    <button @click="show"></button>
    <Upload action="/index/import" :multiple="true">
        <Button icon="ios-cloud-upload-outline">Upload files</Button>
    </Upload>
</div>

<script>
    new Vue({
        el: '#app',
        data: {
            message: 'Hello Vue.js!',
        },
        methods: {
            show() {
                // var formData = new FormData();
                // formData.append("name","张鸿飞")

                var array = new Array();
                array.push("张飞","王磊");

                axios.post("/index/test",array).then(res => {
                    this.message = res;
                })
            },
            beforeUpload(file){
                let mo = {file}

                var array = new Array();
                array.push(mo);

                console.log((file))

                axios.post("/index/import",array).then(res => {
                    this.message = res;
                })
                return false;
            }
        }
    })
</script>
</body>
</html>